import java.util.Arrays;

public class SelectionSortTest {
    public static void main(String[] args) {
//        Integer[] arr = {6, 4, 2, 3, 1, 5};
//        SelectionSort.INSTANCE.printArr(arr);
//
//        System.out.println();
//        SelectionSort.INSTANCE.sort(arr);
//        SelectionSort.INSTANCE.printArr(arr);
//        Student[] arr2 = new Student[]{
//                new Student("6", "stu6", 66, "清华大虚"),
//                new Student("4", "stu4", 44, "清华大虚"),
//                new Student("2", "stu2", 22, "清华大虚"),
//                new Student("3", "stu3", 33, "清华大虚"),
//                new Student("1", "stu1", 11, "清华大虚"),
//                new Student("5", "stu5", 55, "清华大虚"),
//        };
//        System.out.println();
//        SelectionSort.INSTANCE.sort(arr2);
//        SelectionSort.INSTANCE.printArr(arr2);

//        int n = 10000;
//        Integer[] arr = ArrayGenerator.INSTANCE.generatorRandomArray(n, n);
//        long startTime = System.nanoTime();
//        SelectionSort.INSTANCE.sort(arr);
//        long endTime = System.nanoTime();
//        double time = (endTime - startTime) / 1000000000.0;
//        if (!SortingHelper.INSTANCE.isSorted(arr)) throw new RuntimeException("SelectionSort failed");
//        System.out.println(time + "s");
//        SortingHelper.INSTANCE.sortTest(SelectionSort.INSTANCE, ArrayGenerator.INSTANCE.generatorRandomArray(10000, 10000));
        int[] dataSize = {10000, 100000};
        for (int n : dataSize) {
            System.out.println("1.Random Array");
            Integer[] array = ArrayGenerator.INSTANCE.generatorRandomArray(n, n);
            Integer[] array2 = Arrays.copyOf(array, array.length);
            Integer[] array3 = Arrays.copyOf(array, array.length);
            Integer[] array4 = Arrays.copyOf(array, array.length);
            Integer[] array5 = Arrays.copyOf(array, array.length);
            Integer[] array6 = Arrays.copyOf(array, array.length);
            Integer[] array7 = Arrays.copyOf(array, array.length);
            Integer[] array8 = Arrays.copyOf(array, array.length);
            Integer[] array9 = Arrays.copyOf(array, array.length);
            Integer[] array10 = Arrays.copyOf(array, array.length);
            Integer[] array11 = Arrays.copyOf(array, array.length);
            Integer[] array12 = Arrays.copyOf(array, array.length);
            Integer[] array13 = Arrays.copyOf(array, array.length);
            SortingHelper.INSTANCE.sortTest(SelectionSort.INSTANCE, array);
            SortingHelper.INSTANCE.sortTest(InsertionSort.INSTANCE, array2);
            SortingHelper.INSTANCE.sortTest(BubbleSort.INSTANCE, array3);
            SortingHelper.INSTANCE.sortTest(MergeSort.INSTANCE, array4);
            SortingHelper.INSTANCE.sortTest(MergeSort2.INSTANCE, array5);
            SortingHelper.INSTANCE.sortTest(MergeSort3.INSTANCE, array6);
            SortingHelper.INSTANCE.sortTest(MergeSort4.INSTANCE, array7);
            SortingHelper.INSTANCE.sortTest(BUSort.INSTANCE, array8);
            SortingHelper.INSTANCE.sortTest(BUSort2.INSTANCE, array9);
//            SortingHelper.INSTANCE.sortTest(QuickSort.INSTANCE, array10);
            SortingHelper.INSTANCE.sortTest(QuickSort2.INSTANCE, array10);
            SortingHelper.INSTANCE.sortTest(QuickSort2Ways.INSTANCE, array12);
            SortingHelper.INSTANCE.sortTest(QuickSort3Ways.INSTANCE, array13);
            System.out.println("2.Ordered Array:");
            array = ArrayGenerator.INSTANCE.generatorOrderedArray(n);
            array2 = Arrays.copyOf(array, array.length);
            array3 = Arrays.copyOf(array, array.length);
            array4 = Arrays.copyOf(array, array.length);
            array5 = Arrays.copyOf(array, array.length);
            array6 = Arrays.copyOf(array, array.length);
            array7 = Arrays.copyOf(array, array.length);
            array8 = Arrays.copyOf(array, array.length);
            array9 = Arrays.copyOf(array, array.length);
            array10 = Arrays.copyOf(array, array.length);
            array11 = Arrays.copyOf(array, array.length);
            array12 = Arrays.copyOf(array, array.length);
            array13 = Arrays.copyOf(array, array.length);
            SortingHelper.INSTANCE.sortTest(SelectionSort.INSTANCE, array);
            SortingHelper.INSTANCE.sortTest(InsertionSort.INSTANCE, array2);
            SortingHelper.INSTANCE.sortTest(BubbleSort.INSTANCE, array3);
            SortingHelper.INSTANCE.sortTest(MergeSort.INSTANCE, array4);
            SortingHelper.INSTANCE.sortTest(MergeSort2.INSTANCE, array5);
            SortingHelper.INSTANCE.sortTest(MergeSort3.INSTANCE, array6);
            SortingHelper.INSTANCE.sortTest(MergeSort4.INSTANCE, array7);
            SortingHelper.INSTANCE.sortTest(BUSort.INSTANCE, array8);
            SortingHelper.INSTANCE.sortTest(BUSort2.INSTANCE, array9);
//            SortingHelper.INSTANCE.sortTest(QuickSort.INSTANCE, array10);
            SortingHelper.INSTANCE.sortTest(QuickSort2.INSTANCE, array11);
            SortingHelper.INSTANCE.sortTest(QuickSort2Ways.INSTANCE, array12);
            SortingHelper.INSTANCE.sortTest(QuickSort3Ways.INSTANCE, array13);
            System.out.println("+++++++++++++++++++++++++++++++++");

            System.out.println();


        }
    }
}
